package com.ymatou.iapi.trading.userquery.service;

import java.util.ArrayList;

import org.json.JSONException;
import org.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.trading.userquery.parameter.resp.GetBuyerGroupOrderInfosResp;
import com.ymatou.iapi.trading.userquery.parameter.resp.GetBuyerOrderListResp;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.common.entitie.OrderInfoForQuery;
import com.ymttest.utils.EnvSetup;

/**
 * App订单支付 FreeMaker Template自动生成代码
 */
public class GetBuyerOrderListCall extends YmatouBaseCall {
	private static String opurl = "api/BuyerQuery/GetBuyerOrderList";

	public GetBuyerOrderListCall() {
		super(EnvSetup.getSystemUrl("userquery_iapi"), opurl, "POST", "JSON");
	}

	@Override
	public void addDefHeader() {
		// super.addDefHeader();
		client.addHeader("Accept", "text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取code
	 */
	public String getCode() {
		String Code = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Code = String.valueOf(jo.get("code"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取Data
	 * 
	 * @return Data
	 */
	public JSONObject getData() {
		JSONObject Data = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Data = jo.getJSONObject("data");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Data;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String Msg = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Msg = String.valueOf(jo.get("msg"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Msg;
	}

	/**
	 * 
	 * @return
	 */
	public GetBuyerOrderListResp getBuyerGroupOrderInfosResp(){
		GetBuyerOrderListResp resp=null;
		try {
		resp=  (GetBuyerOrderListResp) FormatUtil.GSONToObject(getData().toString()
				, GetBuyerOrderListResp.class);		
		}
		catch  (Exception e) {
			
			e.printStackTrace();
		}
		return resp;
	}

}
